﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Com.CMS263.PO;
using Com.CMS263.Util;
using Com.CMS263.BLL;
using System.Collections.Generic;

namespace Com.CMS263.Web.manage.ManageBaseArtDesc
{
    public partial class BaseArtList : System.Web.UI.Page
    {
        public IList<ArtBase> artList = null;

        ExtAttributeBLL eaBLL = new ExtAttributeBLL();

        ExtValueBLL evBLL = new ExtValueBLL();

        ArtBaseBLL abBLL = new ArtBaseBLL();

        public IList<ExtAttribute> eaList = null;

        int pageSize = 24;

        public int page=1;

        string key = "";

        int typeId;
      //菜单编号
        int menuId;
        public string menuTitle;
        protected void Page_Load(object sender, EventArgs e)
        {
            typeId = int.Parse( Request["pid"]);

           
             key = StringUtil.checkStr(Request["txtKey"]);

             menuId = int.Parse(Request["menuId"]);
             ArtTypeBLL atbll = new ArtTypeBLL();
             ArtType at = atbll.GetArtTypeById(menuId);
             if (at != null)
             {
                 menuTitle = at.typeName;
             }
             else 
             {
                 menuTitle = "";
             }

            eaList = eaBLL.GetShowInBackAttrByTypeId(typeId);

            if (!string.IsNullOrEmpty(Request["page"]))
            {
                page = int.Parse(Request["page"]);
            }
            if (!string.IsNullOrEmpty(key))
            {
                this.txtKey.Text = key;
            }
            artList = abBLL.GetListBySortId(menuId,"Desc",key, page, pageSize);
            
        }
        public string GetExtValueByBaseArtId(int artId,int attrId)
        {
            return evBLL.GetValueById(artId, attrId);
        }
        public string GetPager()
        {
            int total = abBLL.GetListBySortId(menuId, key);
          return   EnPager.GetPager(total,pageSize,page,"&pid="+typeId+"&txtKey="+key+"&menuId="+menuId.ToString());
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }

    }
}
